import java.util.Random;

public class CanRaffleState extends State{
    private Activity activity;

    public CanRaffleState(Activity activity) {
        this.activity = activity;
    }

    @Override
    public void deductMoney() {
        System.out.println("很抱歉,不能扣积分");
    }

    @Override
    public boolean raffle() {
        System.out.println("开始抽奖----");
        Random random = new Random();
        int num = random.nextInt(10);

        if (num==0){
            activity.setState(activity.getDispenseState());
            return true;
        }else {
            System.out.println("很遗憾,没有中奖");
            activity.setState(activity.getNoRaffleState());
            return false;
        }
    }

    @Override
    public void dispensePrize() {
        System.out.println("很抱歉,不能发奖");
    }
}
